import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Scanner;

public class MotherDay {
    public static void main(String[] args) {
        //从控制台输入年份，计算母亲节？(提示：母亲节为每年的5月第二个星期日)
        Scanner input=new Scanner(System.in);
        System.out.println("请输入查询的年份");
        int year=input.nextInt();
        Calendar cal = Calendar.getInstance();
        cal.set(Calendar.YEAR, year);
        cal.set(Calendar.MONTH, 5-1);
        int maxDate = cal.getActualMaximum(Calendar.DATE);
        int sundays = 0;
        for(int i = 1; i <= maxDate; i ++) {
            cal.set(Calendar.DATE, i);
            if(cal.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) {
                sundays ++;
                if(sundays == 2) {
                    break;
                }
            }
        }
        String date = new SimpleDateFormat("yyyy-MM-dd").format(cal.getTime());
        System.out.printf("%s年的母亲节是：%s",year,date);

    }
}
